package mvc.selix;

import java.awt.Dimension;
import java.util.ArrayList;

import javax.media.opengl.GL;
import javax.swing.JLabel;

import org.geom.Vector3D;
import org.geom.render.ViewJOGL;

import mvc.ControllerMouse3D;


public class SelixView3D extends ViewJOGL {
	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	public static boolean trunk_visibility = true;
	private SelixModel curveModel;
		

	public SelixView3D(SelixModel model, Dimension d) {
		super(d);
		this.curveModel = model;
		
		add(new JLabel("3d view"));
	}
	
	@Override
	public void render(GL gl) {
		
		drawCenter(gl);
		drawCurve(curveModel.getPoints(), gl);
		if(trunk_visibility)drawTrunk(gl);
	}
	
	private void drawTrunk(GL gl) {
		ArrayList<Vector3D> points = curveModel.getTrunk().getPoints();
		drawCurvePoints(points, gl);
	}

	public void addMouseKeybController(ControllerMouse3D controller3d) {
		addMouseListener(controller3d);
		addMouseMotionListener(controller3d);
		addKeyListener(controller3d);
	}


}
